home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / AmigaTalk / testfiles / TestDBase4 < prev    next >
Encoding:
Text File  |  2004-01-31  |  1.4 KB  |  49 lines

  1. ")i amigatalk:user/database.st"
  2.  
  3. amigatalk <- AmigaTalk new    " Show User what we are doing. "
  4. dbase     <- DataBase  new
  5. recData   <- DBData    new: 57
  6. keyFile   <- DBKeyFile new
  7.  
  8. baseName  <- 'AmigaTalk:TestFiles/Classes'
  9.  
  10. template  <- dbase readTemplateFrom: (baseName, '.dbf')
  11.  
  12. temp <- dbase open:  baseName
  13. keyFile openKeyFile: (baseName, '.ndx')
  14.  
  15. (' ') print
  16. ( 'Executing the TestDBase4 file...' ) print
  17.  
  18. numRecords <- dbase numberOfRecords
  19.  
  20. ( baseName, ' contains ',numRecords asString, ' record(s)' ) print
  21.  
  22. keyString <- '11112010/31/02' 
  23. chk <- dbase getRecordBy: keyString from: keyFile for: recData
  24.  
  25. ('ClassName of the record is: ',recData retrieveFieldAt: 0 length: 32) print
  26.  
  27. amigatalk setIOTitle:    'TestDBase4 example read (via key):'
  28. amigatalk setIOMessage:  ('key = ', keyString, ' returned:')
  29.  
  30. displayStr <- String new: 256
  31.  
  32. classValue    <- recData retrieveFieldAt: 0  length: 32
  33. createdValue  <- recData retrieveFieldAt: 32 length: 8
  34. attrCodeValue <- recData retrieveFieldAt: 40 length: 6
  35. notesValue    <- recData retrieveFieldAt: 46 length: 10
  36.  
  37. displayStr at: 0 put: 'ClassName: ',classValue,             displayStr cr, \
  38.                       'Created  : ',createdValue  asString, displayStr cr, \
  39.                       'AttrCode : ',attrCodeValue asString, displayStr cr, \
  40.                       'Notes    : ',notesValue    asString
  41.  
  42. amigatalk displayString: displayStr
  43.  
  44. dbase   close
  45. keyFile close
  46.  
  47. ( 'Done with TestDBase4 file!' ) print
  48.  
  49.